package itsm.isperp.module.service.kpi;

import itsm.isperp.framework.data.jdbc.BeanRowMapper;
import itsm.isperp.framework.service.BaseService;
import itsm.isperp.module.entity.kpi.KpiSetting;
import itsm.isperp.module.repository.kpi.KpiSettingMapper;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;

/**
 * 服务
 * 
 * @author lizx
 * @date 2015-12-01 10:51
 */
@Service
public class KpiSettingService extends BaseService<KpiSetting> {

	@Autowired
	protected KpiSettingMapper kpiSettingMapper;

	@Autowired
	protected JdbcTemplate jdbcTemplate;

	@Override
	public KpiSettingMapper getRepository() {
		return this.kpiSettingMapper;
	}

	public List<KpiSetting> findByModelName(String moduleName) {
		List<KpiSetting> list = jdbcTemplate
				.query("SELECT * FROM kpi_setting WHERE module_name=? and description<>'不显示' ORDER BY ORDER_NUM ASC",
						new BeanRowMapper<KpiSetting>(KpiSetting.class),
						moduleName);
		return list;
	}
}
